const { requestHasToken, request } = require('../util/server');

//#region 量表类目
// 修改表类别状态
export const updateChartCategoryStatus = (categoryId, categoryEnable) => {
  return requestHasToken({
    url: '/category/updateEnable',
    method: 'put',
    data: {
      categoryId, categoryEnable
    }
  })
};


// 量表是否显示、是否推荐
export const getShowStatus = query => {
  return requestHasToken({
    url: '/schoolPsychology/UpdateSchoolPsychologyState/',
    method: 'post',
    data: query
  })
};

// 设置推广人
export const setPromoters = () => {
  return requestHasToken({
    url: '/TbUser/selectMarketUserList',
    method: 'post',
  })
}
// ----------------自己后加的-----------------------------
export const setPromoters2 = data => {
  return requestHasToken({
    url: '/enterprise/selectMarketUserList',
    method: 'get',
    data
  })
}
export const getTemperaturePeople = enterpriseName => {
  return requestHasToken({
    url: `/enterprise/queryEnterpriseAnimalHeat/${enterpriseName}`,
    method: 'get',
  })
}
export const getPsychologPeople = enterpriseId => {
  return requestHasToken({
    url: `/enterprise/queryEnterprisePsychologyNumber/${enterpriseId}`,
    method: 'get',
  })
}
// 获取公司数据
export const getFirmInformations = enterpriseId => {
  return requestHasToken({
    url: `/KnowledgeStatistics/queryKnowledgeTotalNumber/${enterpriseId}`,
    method: 'get',
  })
}
// 获取过去的周同比 公司的数据
export const getFirmPerInformations = enterpriseId => {
  return requestHasToken({
    url: `/KnowledgeStatistics/queryKnowledgeSevenDaysNumberById/${enterpriseId}`,
    method: 'get',
  })
}
// 获取日环比
export const getFirmPerDayInfors = enterpriseId => {
  return requestHasToken({
    url: `/KnowledgeStatistics/queryqknowledgeYesterdayNumberById/${enterpriseId}`,
    method: 'get',
  })
}

export const getSchoolFatPeople = enterpriseName => {
  return requestHasToken({
    url: `/enterprise/queryHealthAssessment/${enterpriseName}`,
    method: 'get',
  })
}
// ------------------------END-------------------------------------

// 将企业或学校的id 和推广人的Id返回给后端
// export const boundentErpriseIdPromotionId = query => {
//   return requestHasToken({
//     url: '/TbUser/SchoolInsertMarketUser',
//     method: 'post',
//     data: query,
//   })
// }
export const boundentErpriseIdPromotionId = query => {
  return requestHasToken({
    url: '/enterprise/SchoolInsertMarketUser',
    method: 'post',
    data: query,
  })
}

// 修改表类别
export const updateChartCategory = category => {
  return requestHasToken({
    url: '/category/updateCategory',
    method: 'put',
    data: category
  })
};
// 不分页查询量表类目
export const getChartCategoryList = () => {
  return requestHasToken({
    url: '/category/queryAll',
    method: 'get'
  })
};
// 根据类目获取量表
export const getChartByCategoryId = categoryId => {
  return requestHasToken({
    url: `/recommend/queryType/${categoryId}`,
    method: 'get'
  })
};
//#endregion

//#region 量表推荐设置
// 添加推荐量表
export const addRecommendChart = chart => {
  return requestHasToken({
    url: '/recommend/createRecommend',
    method: 'post',
    data: chart
  })
};
// 分页查询推荐量表
export const getRecommendChartPagi = query => {
  return requestHasToken({
    url: '/recommend/queryRecommendPage',
    method: 'post',
    data: query
  })
};
// 修改推荐量表启用状态
export const updateRecommendChartStatus = (recommendId, recommendStatus) => {
  return requestHasToken({
    url: '/recommend/updateRecommendStatus',
    method: 'put',
    data: {
      recommendId, recommendStatus
    }
  })
}

//#endregion

//#region 页面数据设置
// 健康尺测试页面菜单项添加
export const addFitbarMenuItem = menu => {
  return requestHasToken({
    url: '/toolsMenu/createToolsMenu',
    method: 'post',
    data: menu
  })
};
// 查询菜单项
// export const getFitbarMenuItem = () => {
//   return request({
//     url: '/auth/toolsMenu/queryToolsMenu',
//     method: 'get'
//   })
// };
export const getFitbarMenuItem = () => {
  return request({
    url: '/auth/toolsMenu/queryToolsMenuManagement',
    method: 'get'
  })
};
// 修改菜单项状态
export const updateMenuItemStatus = menu => {
  return requestHasToken({
    url: '/toolsMenu/updateMenuStatus',
    method: 'put',
    data: menu
  })
};
// 添加习惯颜色
export const addHabitColor = color => {
  return requestHasToken({
    url: '/color/createColor',
    method: 'post',
    data: {
      colorValue: color
    }
  })
};
// 查询习惯颜色列表
export const getHabitColorList = () => {
  return requestHasToken({
    url: '/color/queryColor',
    method: 'get'
  })
};
// 修改菜单项
export const updateHomeMenu = menu => {
  return requestHasToken({
    url: '/toolsMenu/updateToolsMenu',
    method: 'put',
    data: menu
  })
};
// 修改习惯颜色
export const updateHabitColor = color => {
  return requestHasToken({
    url: '/color/updateColor',
    method: 'put',
    data: color
  })
};
// 删除颜色
export const deleteHabitColor = colorId => {
  return requestHasToken({
    url: `/color/deleteById/${colorId}`,
    method: 'delete'
  })
};
// 添加默认习惯
export const addDefaultHabit = habit => {
  return requestHasToken({
    url: '/habit/createHabit',
    data: habit,
    method: 'post'
  })
};
// 查询默认习惯
export const getDefaultHabitList = query => {
  return requestHasToken({
    url: '/habit/masterIdNullQuery',
    data: query,
    method: 'post'
  })
};
// 修改默认习惯
export const updateDefaultHabit = habit => {
  return requestHasToken({
    url: '/habit/updateHabit',
    method: 'put',
    data: habit
  })
}


//#endregion

//#region 健康数据项
// 新建健康数据标签
export const addHealthDataLabel = label => {
  return requestHasToken({
    url: '/lable/createLable',
    method: 'post',
    data: label
  })
};
// 查询所有健康数据标签
export const getHealthDataLabelList = () => {
  return requestHasToken({
    url: '/lable/queryLableAll',
    method: 'get'
  })
};
// 修改健康数据标签状态
export const updateDataLabelStatus = (labelId, status) => {
  return requestHasToken({
    url: '/lable/updateLableStatus',
    method: 'put',
    data: {
      labelId: labelId,
      labelStatus: status
    }
  })
};
// 修改健康数据标签
export const updateHealthLabel = label => {
  return requestHasToken({
    url: '/lable/updateLable',
    method: 'put',
    data: label
  })
}

//#endregion

//#region 关键字
// 添加关键字
export const addKeyWord = (keyWord, parentId) => {
  return requestHasToken({
    url: '/keyword/insertKeyword',
    method: 'post',
    data: {
      keywordTitle: keyWord,
      parentId
    }
  })
};
// 查询所有关键字
export const getAllKeyWords = () => {
  return requestHasToken({
    url: '/keyword/queryAll',
    method: 'get'
  })
}
// 查询父子和子级的关键字
export const getkeyWord = key => {
  return requestHasToken({
    url: '/keyword/selectSecondLevelKeyword',
    method: 'post',
    data:key,
  })
}

// 修改关键字
export const updateKeyWord = query => {
  return requestHasToken({
    url: '/keyword/updateKeyWord',
    method: 'put',
    data: query,
  })
}


//#endregion

//#region 机构管理
// 创建机构
export const addOrganization = organization => {
  return requestHasToken({
    url: '/enterprise/createEnterprise',
    method: 'post',
    data: organization
  })
};
// 查询所有机构
export const getAllOrganization = () => {
  return requestHasToken({
    url: '/enterprise/queryAll',
    method: 'get'
  })
};
// 查询机构列表
export const getOrganizationListByType = query => {
  return requestHasToken({
    url: '/enterprise/queryEndElementPage',
    method: 'post',
    data: query
  })
};
// 修改机构信息
export const alterOrganizationInfo = query => {
  return requestHasToken({
    url: '/enterprise/UpdateEnterpriseNameAndMemberEnterpriseName',
    method: 'post',
    data: query,
  })
}

// 禁用机构信息
export const forbiddenEnterprise = query => {
  return requestHasToken({
    url: '/enterprise/updateEnterpriseStatus',
    method: 'put',
    data: query,
  })
}

// 查询机构成员列表
export const getEnterpriseMember = data => {
  return requestHasToken({
    url: '/enterprise/queryMemberInformation',
    method: 'post',
    data
  })
};
// 设置是否显示行程
export const changeShowTravel = (enterpriseId, showTravel) => {
  return requestHasToken({
    url: '/enterprise/updateShowTravel',
    method: 'put',
    data: {
      enterpriseId, showTravel
    }
  })
}

//#endregion

//#region 知识管理
// 创建知识
export const addKnowledge = knowledge => {
  return requestHasToken({
    url: '/TbKnowledge/addTbKnowledge',
    method: 'post',
    data: knowledge
  })
};
// 上传视频
export const uploadVideo = video => {
  return requestHasToken({
    url: '/upload/batchUploadImage',
    method: 'post',
    data: video
  })
};
// 查询知识
export const getKnowledgeList = query => {
  return requestHasToken({
    url: '/TbKnowledge/queryTbKnowledgePage',
    method: 'post',
    data: query
  })
};
// 获取文章详情
export const getArticleInfo = knowledgeId => {
  return requestHasToken({
    url: `/TbKnowledge/knowledgeDetails/${knowledgeId}`,
    method: 'get'
  })
};



export const getArticleDetile = knowledgeId => {
  return requestHasToken({
    url: `/TbKnowledge/knowledgeDetails/${knowledgeId}`,
    method: 'get'
  })
}

// 保存修改文章
export const editArticle = query => {
  return requestHasToken({
    url: `/TbKnowledge/updateManagementKnowledge`,
    method: "put",
    data: query
  })
}

// 数据分析
export const getFindAnalysisData = enterpriseId => {
  return requestHasToken({
    url: `/TbKnowledge/knowledgeNumber/${enterpriseId}`,
    method: 'get'
  })
};
export const getFindAnalysisData2 = enterpriseId => {
  return requestHasToken({
    url: `/KnowledgeStatistics/queryKnowledgeNumber/${enterpriseId}`,
    method: 'get'
  })
};
// 获取点赞top10
export const getLikeTop10 = enterpriseId => {
  return requestHasToken({
    url: `/TbKnowledge/thumbUpQuantity/${enterpriseId}`,
    method: 'get'
  })
};
// 获取分享top10
export const getShareTop10 = enterpriseId => {
  return requestHasToken({
    url: `/TbKnowledge/amountOfShare/${enterpriseId}`,
    method: 'get'
  })
};
// 获取浏览量top10
export const getBrowserTop10 = enterpriseId => {
  return requestHasToken({
    url: `/TbKnowledge/pageView/${enterpriseId}`,
    method: 'get'
  })
};
// 改变审核状态
export const changeAuthorityStatus = data => {
  return requestHasToken({
    url: '/TbKnowledge/updateKnowledgeStatus',
    data,
    method: 'put'
  })
};
// 改变禁用状态
export const changeShowStatus = data => {
  return requestHasToken({
    url: '/TbKnowledge/updateKnowledgeLife',
    method: 'put',
    data
  })
};
// 将知识在公司中置顶
export const makeItToFirstInCompany = data => {
  return requestHasToken({
    url: '/TbKnowledge/updateIsFirst',
    method: 'put',
    data
  })
}

// 修改浏览量、收藏量
export const collectNum = query => {
  return requestHasToken({
    url: '/TbKnowledge/updateKnowledgeFakeNumber',
    method: 'post',
    data: query,
  })
}

//是否推荐
export const changeRecommend = query => {
  return requestHasToken({
    url: '/TbKnowledge/updateIsRecommend',
    method: 'put',
    data: query,
  })
}

// 是否轮播
export const changeHandleslideshow = query => {
  return requestHasToken({
    url: '/TbKnowledge/updateSlideshow',
    method: 'put',
    data: query,
  })
}

//#endregion

//#region 广告管理
// 创建广告
export const createAd = ad => {
  return requestHasToken({
    url: '/advertisement/createAdvertisement',
    method: 'post',
    data: ad
  })
}

// 获取广告标题
export const getAdTitle = query => {
  return requestHasToken({
    url: '/TbKnowledge/selectKnowledgeNameById',
    method: 'post',
    data: query,
  })
}

// 查询所有弹屏广告
export const getAdList = () => {
  return requestHasToken({
    url: '/advertisement/queryAll',
    method: 'get'
  })
};
// 修改弹屏广告状态
export const changeAdStatus = ad => {
  return requestHasToken({
    url: '/advertisement/updateAdvertisementStatus',
    method: 'put',
    data: ad
  })
};
// 添加轮播图
export const deleteBanner = id => {
  return requestHasToken({
    url: '/banner/deleteById/' + id,
    method: 'delete'
  })
}


//#endregion

//#region 心理统计
// 查询学校班级
export const getSchoolInfo = provinceId => {
  return requestHasToken({
    url: '/enterprise/querySchoolName',
    // url: "/auth/enterprise/querySchoolName",
    method: 'post',
    data: provinceId
  })
};

export const getGradeInfo = enterpriseName => {
  return requestHasToken({
    url: '/enterprise/querySchoolName',
    // url: "/auth/enterprise/querySchoolName",
    method: 'post',
    data: enterpriseName
  })
};

export const getSchoolInfoCity = cityId => {
  return requestHasToken({
    url: '/enterprise/querySchoolName',
    // url: "/auth/enterprise/querySchoolName",
    method: 'post',
    data: cityId
  })
};

// 查询省份信息
export const getProvinceInfo = query => {
  return requestHasToken({
    // url: "/tbArea/queryAll",
    // url: "/tbArea/selectByIdCity/",
    url:'/tbArea/queryByIdAll',
    method: 'post',
    data: query,
  })
}

// 查询城市信息
export const getCityInfo = query => {
  return requestHasToken({
    url: "/tbArea/queryByIdAll",
    method: "post",
    data: query,
  })
}

// 获取成员信息
export const getInfo = forschoolName => {
  return requestHasToken({
    url: `/memberDetails/selectGradesMemberNumber/${forschoolName.forschoolName}`,
    method: 'get',
    data:forschoolName,
  })
}

// 查询统计主体成员
export const getSchoolMember = query => { // 查询统计主体成员
  return requestHasToken({
    url: '/member/querySchoolMember',
    method: 'post',
    data: query
  })
};
// 查询心理综述
export const getMentalSummary = enterpriseName => {
  return requestHasToken({
    url: `/report/psychologicalReport/${enterpriseName}`
  })
}

//#endregion

//#region 结果描述设置
// 添加结果描述
export const addComment = comment => {
  return requestHasToken({
    url: '/bmiDesc/createBmiDesc',
    method: 'post',
    data: comment
  })
};
// 查询结果描述
export const getCommentListByPage = query => {
  return requestHasToken({
    url: '/bmiDesc/queryBmiDesc',
    method: 'post',
    data: query
  })
};
// 修改结果描述
export const updateComment = comment => {
  return requestHasToken({
    url: '/bmiDesc/updateBmiDesc',
    method: 'put',
    data: comment
  })
}



//#endregion

//#region 名片管理
// 分页查询名片
export const getBusinessCardByPage = query => {
  return requestHasToken({
    url: '/visitingCard/pageVisitingCard',
    method: 'post',
    data: query
  })
};
// 修改禁用/启用状态
export const changeCardStatus = data => {
  return requestHasToken({
    url: '/visitingCard/updateAuditStatus',
    data,
    method: 'put'
  })
};
// 修改审核状态
export const setCardAuthority = data => {
  return requestHasToken({
    url: '/visitingCard/updateVisitingCardStatus',
    data,
    method: 'put'
  })
}


//#endregion

//#region 机构量表设置
// 设置机构量表
export const setCompanyChart = data => {
  return requestHasToken({
    url: '/schoolPsychology/createTbSchoolPsychology',
    method: 'post',
    data
  })
};
// 查询机构量表
export const getCompanyChart = query => {
  return requestHasToken({
    url: '/schoolPsychology/querySchoolId',
    method: 'post',
    data: query
  })
}

//#endregion

//#region 心理统计
// 查询心理答题详情
export const getMentalRecordInfo = (memberId, orderNum) => {
  return requestHasToken({
    url: `/psychologicalListing/${memberId}/${orderNum}`,
    method: 'get'
  })
}

//#endregion

//#region 查询统计信息
// 查询机构统计信息
export const getEnterpriseConsume = () => {
  return requestHasToken({
    url: '/enterprise/queryNumber',
    method: 'get'
  })
};
// 查询注册用户
export const getUserConsume = () => {
  return requestHasToken({
    url: '/wechat/member/queryMemberNumber',
    method: 'get'
  })
};

// 根据时间快捷查询用户
export const getUserNumByDate = (startTime, endTime) => {
  return requestHasToken({
    url: '/wechat/member/userNumber',
    method: 'post',
    data: {
      startTime, endTime
    }
  })
};
// 查询学校人数
export const getMemberBySchool = schoolName => {
  return requestHasToken({
    url: '/memberDetails/selectGradeMemberNumber/' + schoolName,
    method: 'get'
  })
}

//#endregion

//#region 体育管理
// 添加测试项
export const createSportItem = item => {
  return requestHasToken({
    url: '/examItem/createExamItem',
    method: 'post',
    data: item
  })
};
// 修改测试项
export const updateSportItem = item => {
  return requestHasToken({
    url: '/examItem/updateExamItem',
    method: 'put',
    data: item
  })
};
// 修改测试项状态
export const updateSportItemStatus = (id, testItemStatus) => {
  return requestHasToken({
    url: '/examItem/updateTestItemStatus',
    method: 'put',
    data: {
      id, testItemStatus
    }
  })
};
// 分页查询测试项
export const getSportItemByPage = query => {
  return requestHasToken({
    url: '/examItem/pageExamItem',
    method: 'post',
    data: query
  })
};
// 不分页查询测试项
export const getAllSportItem = type => {
  return requestHasToken({
    url: '/examItem/queryExamItem/' + type,
    method: 'get'
  })
};
// 删除测试项
export const deleteSubject = id => {
  return requestHasToken({
    url: '/examItem/deleteById/' + id,
    method: 'delete'
  })
}


//#endregion

//#region 查看成员体温/行程
// 查询成员体温
export const getMemberTemperature = query => {
  return requestHasToken({
    url: '/lableRecord/memberTemperature',
    method: 'post',
    data: query
  })
};
// 查询成员行程
export const getMemberMoveLine = query => {
  return requestHasToken({
    url: '/deviceLocation/memberLocation',
    method: 'post',
    data: query
  })
};
// 分页查询体温统计
export const getMemberTemperatureDataPage = query => {
  return requestHasToken({
    url: '/lableRecord/pageBodyTemperature',
    method: 'post',
    data: query
  })
};
// 不分页查询体温统计
export const getMemberTemperatureData = query => {
  return requestHasToken({
    url: '/lableRecord/queryBodyTemperature',
    method: 'post',
    data: query
  })
}

//#endregion

//#region 消防管理
// 添加消防职务
export const createFiremanCareer = data => {
  return requestHasToken({
    url: '/fire/insertFireIdentityPosition',
    method: 'post',
    data
  })
};
// 修改消防职务
export const updateFiremanCareer = data => {
  return requestHasToken({
    url: '/fire/updateFireIdentityPosition',
    method: 'put',
    data
  })
};
// 查询消防职务
export const getFiremanCareer = query => {
  return requestHasToken({
    url: '/fire/selectFireIdentityPosition',
    method: 'post',
    data: query
  })
};
// 删除职务
export const deleteFiremanCareer = id => {
  return requestHasToken({
    url: '/fire/deleteFireIdentityPosition/' + id,
    method: 'delete'
  })
};
// 给干部分配班级
export const giveFiremanClass = data => {
  return requestHasToken({
    url: '/thacherClass/createThacherClass',
    data,
    method: 'post'
  })
};
// 查询用户班级
export const getFiremanClass = userId => {
  return requestHasToken({
    url: '/thacherClass/queryUserId/' + userId,
    method: 'get'
  })
};
// 删除关联班级
export const deleteFiremanClass = id => {
  return requestHasToken({
    url: '/thacherClass/deleteById/' + id,
    method: 'delete'
  })
};
// 查询消防员测试的科目
export const getMemberSubject = memberId => {
  return requestHasToken({
    url: `/examItemResults/queryMemberResults/${memberId}`,
    method: 'get'
  })
};
// 查询科目成绩
export const getSubjectGrade = data => {
  return requestHasToken({
    url: '/examItemResults/queryMemberResultss',
    method: 'post',
    data
  })
}

//#endregion

//#region 科目规则管理
// 添加科目规则
export const createSubjectRule = rule => {
  return requestHasToken({
    url: '/examItemRule/createExamItemRule',
    method: 'post',
    data: rule
  })
};
// 修改科目规则
export const updateSubjectRule = rule => {
  return requestHasToken({
    url: '/examItemRule/updateExamItemRule',
    method: 'put',
    data: rule
  })
};
// 分页查询规则
export const getSubjectRuleList = query => {
  return requestHasToken({
    url: '/examItemRule/pageExamItemRule',
    method: 'post',
    data: query
  })
};
// 删除科目规则
export const deleteSubjectRule = id => {
  return requestHasToken({
    url: '/examItemRule/deleteById/' + id,
    method: 'delete'
  })
}

//#endregion

//#region 设备管理
// 添加手环
export const createDeviceNo = data => {
  return requestHasToken({
    url: '/equipmentNumber/createEquipmentNumber',
    data,
    method: 'post'
  })
};
// 分页查询设备
export const getDeviceNoPagi = query => {
  return requestHasToken({
    url: '/equipmentNumber/pageEquipmentNumber',
    method: 'post',
    data: query
  })
};
// 修改设备编号
export const updateDeviceNo = data => {
  return requestHasToken({
    url: '/equipmentNumber/updateEquipmentNumber',
    method: 'put',
    data
  })
};
// 删除设备
export const deleteDeviceNo = id => {
  return requestHasToken({
    url: `/equipmentNumber/deleteById/${id}`,
    method: 'delete'
  })
}

//新家的查询
export const getADPerson = dataTest => {
  return requestHasToken({
    url: '/enterprise/selectMarketUserList',
    method: 'post',
    dataTest
  })
};

//#endregion

